home *** CD-ROM | disk | FTP | other *** search
/ Programming Microsoft Visual Basic .NET / Programming Microsoft Visual Basic .NET (Microsoft Press)(X08-78517)(2002).bin / 25 user and custom controls / customcontrollibrary / firstcontrol.vb < prev    next >
Encoding:
Text File  |  2002-03-19  |  871 b   |  32 lines

  1. ' A simple custom control that implements a push buttom
  2.  
  3. Imports System.ComponentModel
  4. Imports System.Web.UI
  5.  
  6. <DefaultProperty("Text"), ToolboxData("<{0}:FirstControl runat=server></{0}:FirstControl>")> Public Class FirstControl
  7.     Inherits System.Web.UI.WebControls.WebControl
  8.  
  9.     ' The Text property
  10.  
  11.     Dim _text As String
  12.  
  13.     <Bindable(True), Category("Appearance"), DefaultValue("")> _
  14.     Property [Text]() As String
  15.         Get
  16.             Return _text
  17.         End Get
  18.  
  19.         Set(ByVal Value As String)
  20.             _text = Value
  21.         End Set
  22.     End Property
  23.  
  24.     ' We override the Render method to send the correct HTML text
  25.     ' to the client
  26.  
  27.     Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
  28.         output.Write("<input type=""button"" Value=""" & [Text] & """>")
  29.     End Sub
  30.  
  31. End Class
  32.